﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Pavilion;

namespace Pavilion.Control
{
    public class ImagePanel : Control
    {
        private Texture2D imageTexture;
        private ContentManager content;

        public ImagePanel(string imagePath) : base()
        {
            content = new ContentManager(GameEngine.Services);

            imageTexture = content.Load<Texture2D>(imagePath);

            AreaBounds = new Rectangle(0, 0, imageTexture.Width, imageTexture.Height);
        }
        
        public override void Draw()
        {
            if (!Visible)
                return;

            DrawManager.Instance.Draw(imageTexture, new Vector2(ScreenBounds.X, ScreenBounds.Y), Color.White);

            base.Draw();
        }

        /// <summary>
        /// Gets the image texture of this panel.
        /// </summary>
        private Texture2D Texture
        {
            get { return imageTexture; }
        }
    }
}
